from django.contrib import admin
from jobs.models import Job, Company, Employment

class EmploymentAdmin(admin.ModelAdmin):
    list_display = ('company', 'employee', 'work_email')
    list_filter    = ('company',)
    ordering       = ('company', 'employee')
    

class JobInline(admin.TabularInline):
    model = Job

class CompanyAdmin(admin.ModelAdmin):
    inlines = (JobInline,)
    list_display = ('name', 'location', 'email', 'description', 'url', 'phone', 'twitter', 'last_update',)
    list_filter    = ('location',)
    ordering       = ('name',)
    search_fieldsets = ('name', 'description', 'location',)
    date_hierarchy = 'last_update'

admin.site.register(Employment, EmploymentAdmin)
admin.site.register(Company, CompanyAdmin)

